package com.oodso.say;

import android.app.Application;
import android.content.Context;
import android.support.multidex.MultiDex;

import com.facebook.drawee.backends.pipeline.Fresco;
import com.oodso.say.utils.ACache;
import com.oodso.say.utils.ImagePipelineConfigFactory;

/**
 * Created by xulei on 2018/2/27.
 * 项目： PACKAGE_NAME
 * 功能描述：
 * 备注：
 */

public class MyApplication extends Application {

    private static ACache mACache;
    private static MyApplication instance;

    @Override
    public void onCreate() {
        super.onCreate();
        mACache = ACache.get(this);
        instance = this;
        Fresco.initialize(this, ImagePipelineConfigFactory.getImagePipelineConfig(this));


    }

    public static MyApplication getInstance() {
        // 这里不用判断instance是否为空
        return instance;
    }
    public static ACache getACache() {
        if (mACache == null)
            mACache = ACache.get(getInstance());
        return mACache;
    }


    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        //方法数超过64K
        MultiDex.install(this);
    }
}
